package com.karry.yl.web.elder;


import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.karry.commons.base.SuperController;
import com.karry.commons.vo.JsonResponse;
import com.karry.yl.domain.elder.ElderlyPath;
import com.karry.yl.service.elder.ElderlyPathService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


/**
 * 老人资料 class
 *
 * @author lyh
 * @date 2019/1/31
 */

@Controller
@RequestMapping("/elderlyPth")
public class ElderlyPathController extends SuperController {

    private static final Logger LOG = LoggerFactory.getLogger(ElderlyPathController.class);
    @Autowired
    private ElderlyPathService elderlyPathService;

    @RequestMapping("/save")
    @ResponseBody
    public JsonResponse save(ElderlyPath elderlyPath) {
        elderlyPath.setOrgId(currentUser.getOrgId());
        elderlyPathService.insert(elderlyPath);
        return JsonResponse.success(elderlyPath);
    }
    @RequestMapping("/delete")
    @ResponseBody
    public JsonResponse delete(Long id){
        elderlyPathService.delete(new EntityWrapper<ElderlyPath>().eq("orgId",currentUser.getOrgId()).eq("id",id));
        return  JsonResponse.success();
    }

}
